<template>
	<view>
		<!-- <text style="font-size: 60rpx;font-weight: bold;margin:30rpx;text-align:center;color:hotpink;margin-left: 35%;">我的收藏</text> -->
		<view style="display: flex;flex-direction: row;flex-wrap: wrap;justify-content: space-between;">
			<view v-if="likedata.length>0" v-for="(item,index) in likedata" class="goodsbox" @click="godetail(item.id)">
				<image :src="item.thumbs" style="width:100%;height:350rpx;border-radius:15rpx ;"></image>
				<text style="font-weight: bold;font-size: 35rpx;">{{item.name}}</text>
				<view>	<text style="color:red;width: 100%;">￥ {{item.present_price}}</text></view>
				<view>
				<text style="color:lightgrey;"> 已售{{item.sale_nums}}件</text>
				</view>
			</view>
			<view v-if="likedata.length<=0" style="text-align: center;padding:15%;">
				<image src="https://lbqny.migugu.com/admin/public/no-data-2.png" style="width: 514rpx;height:260rpx;"></image>
				<text style="color:lightgrey;">暂无相关数据哦</text>
			</view>
			
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				title:"我的收藏",
				likedata:[],
			}
		},
		  onBackPress(options) {  
		  uni.redirectTo({
		  	url:"/pages/mine"
		  }) 
		  },  
		onLoad() {  
		  uni.setNavigationBarTitle({  
		    title: '我的收藏'  
		  });  
		  	console.log(this.likedata.length)
		  this.getlikedata()
		},
		methods: {
			godetail()
			{
				let url = `/user/pages/shop/goods-detail-pay?id=28`
				this.$util.goUrl({
					url
				})
			},
			async getlikedata()
			{
				let data = await this.$api.service.myLikegoods({
					page: 1
				})
				this.likedata = data
				console.log(this.likedata.length)
			}
		}
	}
</script>

<style>

</style>
